object main extends Application {
  class Foo(val x: Int, val y: String)

  object Foo {
     def unapply(t: Any): Option[(Int, String)] = t match {case f: Foo
  => Some((f.x, f.y))  case _ => None}
     def apply(x: Int, y: String) = new Foo(x, y)
  }


  def examine(t: Any) = for( (x, y) <- Foo.unapply(t)) yield x + y
  // why can't I write the following instead?
  // def examine(t: Any) = for( Foo(x, y) <- t) yield x + y

  examine(Foo(1,"23"))
}


